//*********************************************************
//
// Output Registers used:
//   oPos - The vertex output position.
//   oT0  - original UV
//   oT1  - original UV for normal map
//   oT2  - Light direction in tangentspace
//   oD0  - light diffuse
//
// Temporary Registers used:
//   r0, r1, r2, r3
//*********************************************************

// oPos = MVP * position
m4x4 r0, inPos, c[MODEL_VIEW_PROJECTION]
mov oPos, r0

// r4 = TangentMatrix[-1] * LightDir
dp3  r4.x, v3, c[VL_MODEL_SPACE_LIGHT_DIR_SHADOWLENGTH]
dp3  r4.y, v4, c[VL_MODEL_SPACE_LIGHT_DIR_SHADOWLENGTH]
dp3  r4.z, inNormal, c[VL_MODEL_SPACE_LIGHT_DIR_SHADOWLENGTH]
mov oT2, r4.xyz

// oT0 = texcoord
mov oT0, inUV

// oT1 = texcoord for normal map
mov oT1, inUV

mov r0, c[MATERIAL_DIFFUSE_OPACITY]
mul oD0, r0, c[VL_DLIGHT_DIFFUSE_1]

mov r0, c[MATERIAL_SPECULAR_POWER]
mul oD1.rgb, r0, c[VL_DLIGHT_SPECULAR_1]
mov oD1.a, c[CONSTANT_0_05_1_2].x
